<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/3/20 0020
  Time: 下午 4:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>投票测试页面</title>
    <style>
    </style>
    <script src="${cdnContentPath}/static/jquery/jquery-3.1.0.min.js"></script>
</head>
<body>
<%--<img src="img/jiaru.png" style="width:100%;height:100%;z-index: 999" alt="新途微助手"/>--%>
    <div style="width:700px;height:400px;float:left" id="stp">
        <h1>成功投票</h1>
    </div>
    <div style="width:900px;height:400px;background:blanchedalmond;float:left" id="error">
        <h1>错误投票</h1>
    </div>
<script>
    $(document).ready(function(){

        var i = 1;
        while(i < 200){
            startPt(i);
            i++;
        }

/*
        var y = 20;
        while(y < 40){
            startPt(y);
            y++;
        }


        var z = 40;
        while(z < 60){
            startPt(z);
            z++;
        }



        var q = 60;
        while(q < 80){
           startPt(q);
            q++;
        }


        var s = 80;
        while(s < 120){
           startPt(s);
            s++;
        }*/

        var total = 0;
        var tag = 0;

        function startPt(userId){
            $.post("/mulanweb/event/startVote",{userId:userId},function(info){
                var value = info.value;
                tag++;
                if(info.code != 0){
                    total++;
                    $("#stp").append('<p>用户主键为: '+userId+' 投票成功,里程为:'+value+';共投票成功:'+total+','+tag+'</p>');
                }else{
                    $("#error").append('<p>用户主键为: '+userId+' 投票错误,错误信息为:'+info.message+';共投票成功:'+total+','+tag+'</p>');
                }
            })
        }

    });
</script>
</body>
</html>
